(function () {
  axios.defaults.baseURL = 'http://124.223.14.236:3001/api'
  const form = document.querySelector(".rg_center .rg_form form")
  form.addEventListener("submit", async function (e) {
    e.preventDefault()
    const res = await axios.post('/user/reg', {
      username: $('#username').val(),
      password: $('#password').val(),
      phone: $('#phone').val(),
      sex: +$('[name=sex]:checked').val(),
      vip: +$('[name=vip]:checked').val(),
      question: $('#question').val(),
      answer: $('#answer').val(),
    })
    console.log(res)
    location.href = "../01-loginBaseCode/login.html"
  })
})()